Skip to content

fix: restore Unity API xref links and update to Unity 6 LTS#32

Merged
NormandErwan merged 5 commits intomainfrom
claude/add-unity-api-xrefs-pXm9W
Apr 20, 2026
Merged

fix: restore Unity API xref links and update to Unity 6 LTS#32
NormandErwan merged 5 commits intomainfrom
claude/add-unity-api-xrefs-pXm9W

Conversation

@NormandErwan
Copy link
Copy Markdown
Owner

@NormandErwan NormandErwan commented Apr 19, 2026

Problem

DocFX v2 uses Roslyn to compile the project during metadata extraction. Without Unity assembly references, Roslyn cannot resolve AudioClipUnityEngine.AudioClip, so <see cref="AudioClip"/> tags in XML doc comments become !:AudioClip in the generated YAML. The xref map at UnityXrefMaps maps UnityEngine.AudioClip → Unity docs URL but has no entry for !:AudioClip, so links are never emitted. allowCompilationErrors: true was silently masking this root cause.

Solution

  • Unity managed DLLs via game-ci: The CI workflow pulls the public unityci/editor:ubuntu-6000.0.73f1-base-3 Docker image (no license required — Unity is never activated, only files are copied) and extracts the full UnityEngine/ directory (~60–80 modules) into lib/. A cache keyed on the Unity version means Docker is only pulled on the first run or when the version changes.
  • Glob-based MSBuild Target: DocFxForUnity.csproj references all *.dll from $(UnityManagedPath) via a batched MSBuild Target — users never need to manually add <Reference> entries when new Unity types appear in their scripts.
  • allowCompilationErrors removed: Compilation now succeeds cleanly, making future errors visible rather than silent.
  • Unity 6 LTS: Updated from the unsupported 2017.4.26f1 to 6000.0.73f1, with the xref map URL pinned to the matching 6000.0 version.

Changes

Commit File(s) What
bf7e191 ProjectSettings/ProjectVersion.txt Update to Unity 6000.0.73f1
c410089 DocFxForUnity.csproj, .gitignore Glob all Unity DLLs; narrow csproj ignore rule; add lib/
7aed77b Documentation/docfx.json Remove allowCompilationErrors; pin xref to 6000.0
a979486 .github/workflows/documentation.yml Cache + Docker extract steps for Unity DLLs

Test plan

  • CI build passes on this branch (first run: Docker pull + cache miss; second run: cache hit, no Docker pull)
  • _site/api/DocFxForUnity.Player.html contains hyperlinks on MonoBehaviour, AudioClip, and AudioSource pointing to docs.unity3d.com
  • No [Warning] xref missing lines in DocFX output
  • No CS0246 compilation warnings in DocFX output

https://claude.ai/code/session_01N4YoJdJc2JDaoAbk5Nt8vf

claude added 4 commits April 19, 2026 20:22
DocFX v2 requires Roslyn to resolve Unity types (MonoBehaviour, AudioClip,
etc.) to their fully-qualified UIDs before the xref map can link them to
docs.unity3d.com. Without assembly references, crefs become !:AudioClip
which never matches the xref map.

A MSBuild Target globs all *.dll from $(UnityManagedPath) (defaulting to
lib/UnityEngine/, populated by CI) so users never need to manually add
<Reference> entries when new Unity types are used in their scripts.

UNITY_MANAGED_PATH env var allows pointing to a local Unity installation
for development without running Docker.

.gitignore: replace broad *.csproj + negation with specific Unity-generated
patterns (Assembly-CSharp*.csproj) so DocFxForUnity.csproj stays tracked
without a fragile negation rule. Add lib/ to ignore extracted DLLs.

https://claude.ai/code/session_01N4YoJdJc2JDaoAbk5Nt8vf
allowCompilationErrors: true was masking the root cause (missing Unity
assembly references). With the glob-based csproj now providing full
Unity type resolution, compilation succeeds cleanly and the flag is
no longer needed. Removing it makes future compilation errors visible.

Pin the UnityXrefMaps URL to the Unity 6 (6000.0) version-specific map
instead of the floating "latest" root URL, matching ProjectVersion.txt.

https://claude.ai/code/session_01N4YoJdJc2JDaoAbk5Nt8vf
Unity managed DLLs are required for Roslyn to resolve UnityEngine types
during DocFX metadata extraction. Rather than committing binaries, the
workflow pulls the public game-ci editor image (no license required) and
copies the full UnityEngine/ directory (~60-80 modules) into lib/.

A cache keyed on the Unity version (6000.0.73f1) stores the extracted
DLLs (~50-150 MB) so Docker is only pulled on the first run or when the
Unity version changes. Subsequent runs skip the extract step entirely.

To update Unity version: bump the version in ProjectVersion.txt,
docfx.json xref URL, DocFxForUnity.csproj comment, and the cache key +
Docker tag here.

https://claude.ai/code/session_01N4YoJdJc2JDaoAbk5Nt8vf
@NormandErwan NormandErwan changed the title chore: update Unity version to 6000.0.73f1 (Unity 6 LTS) fix: restore Unity API xref links and update to Unity 6 LTS Apr 19, 2026
The ubuntu-6000.0.73f1-base-3 tag does not exist. Only platform-specific
images are published for Unity 6000.0.73f1: android, webgl, linux-il2cpp,
mac-mono. Switch to ubuntu-6000.0.73f1-linux-il2cpp-3.2.2, which includes
the full editor with all managed DLLs.

Also add mkdir -p lib before docker cp since the cache step may not have
restored the directory on a cache miss.

https://claude.ai/code/session_01N4YoJdJc2JDaoAbk5Nt8vf
@NormandErwan NormandErwan merged commit 3b56be0 into main Apr 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants